<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../CSS/gwc.css">
    <link rel="stylesheet" href="../font_3sqfkdkt64s/iconfont.css">
    <link rel="stylesheet" href="../font_cnubd6mcu1/iconfont.css">
</head>

<body>
    <header></header>
    <div class="box">
        <div class="big-mar">
        </div>
        <div class="box-but">
            <div class="sum-main clearfix w-1280">
                <div class="sum-infos fl clearfix">
                    <div class="sum-operate fl"><label class="checkbox-label checkbox-all"><input type="checkbox" class="checkbox-input">
                            <i></i><span>全选商品</span></label> <a href="javascript:;" class="delete-multi">删除商品</a></div>
                    <div class="sum-totalprice fr"><span>总价</span> <span class="price">￥0.00</span></div>
                </div>
                <div class="sum-to-settle fl"><a href="javascript:;" class="btn-to-settle">结算</a></div>
            </div>
        </div>
    </div>
    </div>
    <footer></footer>
</body>

</html>
<script src="../jQuery.js"></script>
<script src="../goodsAndShoppingCart/js/cookieTools.js"></script>
<script>
    $("header").load("head.html");
    $("footer").load("footer.html");
</script>
<script>
    let [, goodsId] = location.search.substring(1).split("=");
    let ousername = getCookie("username");

    let htmlStr = "";
    $.get('../goodsAndShoppingCart/getShoppingCart.php', {
        vipName: ousername
    }, function(date) {
        var data = JSON.parse(date)
        data.forEach(element => {
            htmlStr += `
             <h3 class="bt">
                <span>我的购物车</span>
                <i>共 2 件</i>
            </h3>
            <div class="k1">
                <label class="checkbox-label checkbox-all">
                    <input type="checkbox" class="checkbox-input">
               
             
                </label>
            </div>
            <table class="t1">
                <tr class="t2">
                    <td class="td-1">
                        <label class="checkbox-label checkbox-one">
                            <input type="checkbox" class="checkbox-input">
                            <i></i>
                            <!-- <span>全选</span> -->
                        </label>
                    </td>
                    <td class="td-img">
                        <a href="/goods-100219.html" title="篮球鞋">
                        <img src="${element.goodsImg}" alt=""style="width: 100px;height:
    height: 100px;"></a>
                    </td>
                    <td class="td-right">
                        <div class="nr">
                            <div class="fl">
                                <h5>篮球鞋</h5>
                                <p>
                                    <span>颜色:黑/体育红/银色;尺码:40</span>
                                </p>
                            </div>
                            <div class="fr">
                                <span class="nr-21">￥${element.goodsPrice}</span>
                            </div>
                        </div>
                        <div class="nr-but">
                            <p class="fl">
                                <span>数量:</span>
                                <a href="" class="num-minus">-</a>
                                <input type="text" class="num-input"value="1"><a href=""class="num-plus">+</a>
                            </p>
                            <p class="fr">
                                <a href="javascript:;"goodsId=${element.goodsId} class="delete-one"onclick="aas('${element.goodsId}')">删除</a>
                            </p>
                        </div>
                    </td>
                </tr>
            </table>
            `
        });

        $(".big-mar").html(htmlStr)
    })
</script>
<script>
    let ostr = "";

    function aas(goodsId) {
        let xhr = new XMLHttpRequest();
        let ostr = "goodsId=" + goodsId + "&vipName=" + ousername;
        xhr.open("get", "../goodsAndShoppingCart/deleteGoods.php?goodsId=" + goodsId + "&vipName=" + ousername, true);
        xhr.send();
        xhr.onreadystatechange = function() {
            if (xhr.readyState == 4 && xhr.status == 200) {
                if (xhr.responseText == "1") {
                    console.log("12345");
                } else {

                }

            }
        }
    }
</script>